package com.zh.test.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * @describe redis工具类
 * @author zh
 * @date 2021/9/29 13:43
 * @param
 * @return
 */
@Component
public class RedisUtils {

    @Autowired
    public RedisTemplate<String,Object> redisTemplate;

    public void op1(){
        redisTemplate.opsForValue().set("hello","world");
    }
    public String op2(){
        String res = (String)redisTemplate.opsForValue().get("hello");
        System.out.println(res);
        return  res;
    }

}
